package red.action;

import com.opensymphony.xwork2.Action;
import org.springframework.beans.factory.annotation.Autowired;
import red.model.ArticleModel;
import red.service.ArticleService;
import red.util.BaseAction;
import red.util.Model;

import java.util.List;
import java.util.Map;

@SuppressWarnings("ALL")
public class ArticleAction extends BaseAction {

    private Map<String,Object> result;
    @Autowired
    private ArticleService articleService;

    private ArticleModel articleModel;

    private List<ArticleModel> articleModels;

    public ArticleModel getArticleModel() {
        return articleModel;
    }

    public void setArticleModel(ArticleModel articleModel) {
        this.articleModel = articleModel;
    }

    public List<ArticleModel> getArticleModels() {
        return articleModels;
    }

    public void setArticleModels(List<ArticleModel> articleModels) {
        this.articleModels = articleModels;
    }



    public String deleteartic() {
        Model model = getParams();
        articleModel = articleService.deleteartic(model);
        return Action.SUCCESS;
    }
    public String selectall(){
        Model model = getParams();
        articleModels=articleService.selectall(model);
        return Action.SUCCESS;
    }

    public String selectartic() {
        Model model = getParams();
        articleModels=articleService.selectarticle(model);

        return Action.SUCCESS;
    }

}
